﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace Maticsoft.Web.newsinfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CKFinder.FileBrowser fileBrowser = new CKFinder.FileBrowser();
                fileBrowser.BasePath = "../ckfinder/"; //设置CKFinder的基路径 
                fileBrowser.SetupCKEditor(ckcontent);
                Maticsoft.BLL.typeinfo bt = new BLL.typeinfo();
                ddltype.DataSource = bt.GetAllList().Tables[0];
                ddltype.DataTextField = "tname";
                ddltype.DataValueField = "tid";
                ddltype.DataBind();
            }

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string ntitle = this.txtntitle.Text;
            int tid = int.Parse(ddltype.SelectedValue.ToString());
            string ncontent = this.ckcontent.Text;
            //DateTime ntime=DateTime.Parse(this.txtntime.Text);

            Maticsoft.Model.newsinfo model = new Maticsoft.Model.newsinfo();
            model.ntitle = ntitle;
            //model.uid=uid;
            model.ncontent = ncontent;
            model.ntime=DateTime.Now;
            model.tid=tid;
            // model.tid=

            Maticsoft.BLL.newsinfo bll = new Maticsoft.BLL.newsinfo();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "list.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
